#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>


int cmp_t(const void* e1,const void* e2)
{
	return (*(int*)e1 - *(int*)e2);
}

void bubble_qsort(int* base, size_t sz, size_t width, int(*cmp_t)(const void* e1, const void* e2))
{
	int* e1 = base;
	int* e2 = base + 1;
	unsigned int i = 0;
	int flag = 1;
	for (i = 0; i < sz-1; i++)
	{
		unsigned int j = 0;
		for (j = 0; j < sz - i - 1; j++)
		{
			if (cmp_t((char*)(e1+j),(char*)(e1+j+1))>0)
			{
				int tmp = *(base + j);
				*(base + j) = *(base + j + 1);
				*(base + j + 1) = tmp;
				flag = 0;
			}
		}
		if (flag == 1)
			break;
	}
}

int main()
{
	int i = 0;
	int arr[] = { 9,8,7,6,5,4,3,2,1,0 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	bubble_qsort(arr, sz,sizeof(arr[0]), cmp_t);
	for (i = 0; i < sz; i++)
	{
		printf("%d ", *(arr + i));
	}
	return 0;

}